import org.apache.spark.sql.SparkSession

object Mmap {
  def main(args: Array[String]): Unit = {
    val spark = SparkSession.builder()
      .appName("RDDPartitionExample")
      .master("local[*]")
      .getOrCreate()
    val sc = spark.sparkContext

    val rdd = sc.parallelize(List("this is a test","how are you","I am fine","can you tell me"))

    val words = rdd.map(x => (x.split(" ")(0), x))

    println(words.collect().mkString(","))
  }
}
